package priv.ljh.operate.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import priv.ljh.operate.service.BookService;

/**
 * <p>
 * 图片 前端控制器
 * </p>
 *
 * @author hsy
 * @since 2021-05-01
 */

@RestController
public class BookController {
    @Autowired
    BookService bookService;
    @RequestMapping("/insertBook")
    public int insertBook(@RequestParam("title")String title,
                          @RequestParam("stock_quantity") int stock_quantity,
                          @RequestParam("market_price") String market_price,
                          @RequestParam("sell_price") String sell_price){
        System.out.println("插入成功");
        bookService.insertBook(title, stock_quantity, market_price,sell_price);
        bookService.insertDesc(title);
        bookService.insertImagesplus();
        return bookService.insertBookInfo(title,  stock_quantity, market_price,sell_price);
    }
    @RequestMapping("/insertBookInfo")
    public int insertBookInfo(@RequestParam("title")String title,
                          @RequestParam("stock_quantity") int stock_quantity,
                          @RequestParam("market_price") String market_price,
                          @RequestParam("sell_price") String sell_price){
        System.out.println("插入成功");
        return bookService.insertBookInfo(title, stock_quantity, market_price,sell_price);
    }
}
